package com.starlink.common.enums;

import com.google.common.collect.Lists;

import java.util.Arrays;
import java.util.List;

public enum StarTypeEnum {
    STAR_HEALTHY(1, "星健康", Lists.newArrayList(StarSecondTypeEnum.WISDOM_GUARDIAN, StarSecondTypeEnum.TEST_EVALUATION, StarSecondTypeEnum.CERTIFICATE)),
    STAR_NURTURING(2, "星辅育", Lists.newArrayList(StarSecondTypeEnum.READING_LITERACY, StarSecondTypeEnum.WRITING_ABILITY)),
    STAR_TRAVEL(3, "星文旅", Lists.newArrayList()),
    ;

    private Integer type;
    private String desc;
    private List<StarSecondTypeEnum> secondTypes;

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public List<StarSecondTypeEnum> getSecondTypes() {
        return secondTypes;
    }

    StarTypeEnum(Integer type, String desc, List<StarSecondTypeEnum> secondTypes) {
        this.type = type;
        this.desc = desc;
        this.secondTypes = secondTypes;
    }

    public static StarTypeEnum getByType(Integer type) {
        if (type == null) {
            return null;
        }
        return Arrays.stream(values()).filter(item -> type.equals(item.getType())).findFirst().orElse(null);
    }

}
